<style>
    .addBtn {
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }

    .info-wrap > td {
        text-align: center;
        padding-top: 10px;
    }

    .info-wrap > td > div {
        max-height: 200px;
        overflow-y: auto;
    }

    .tiao-val {
        width: 30px;
        height: 30px;
        margin: 5px 5px 0 0;
        outline: none;
        font-size: 14px;
    }

    .tiao-btn {
        font-size: 14px;
    }

    .link-update {
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }

    .link-update:hover {
        text-decoration: none;
        color: white;
        background: #286090;
    }

    .link-del {
        text-decoration: none;
        background: red;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }

    .link-del:hover {
        text-decoration: none;
        background: red;
        color: white;
    }

    .info-wrap {
        border-bottom: 1px solid #cccccc;
    }
</style>
<div class="span10">
    <div style="margin-bottom: 20px;">
        <a href="/index/index">首页</a><span >&gt;</span><a href="/applets/index/index">百度小程序管理</a><span >&gt;</span><span>banner管理</span>
    </div>

    <a class="addBtn" href="<?php echo baseUrl . '/applets/banner/add' ?>">添加banner</a>

    <form action="/content/api/sort" method="post">
        <table border="0" width="100%">
            <tr align="center">
                <th>排序</th>
                <th width="10%">id</th>
                <th width="30%">图片</th>
                <th width="10%">浏览量</th>
                <th width="10%">内容id</th>
                <th width="10%">时间</th>
                <th width="20%">操作</th>
            </tr>
            <?php
            foreach ($data as $v) {
                ?>
                <tr class="info-wrap">
                    <td><input style="width: 20px;" name="sort[]" type="text" value="<?php echo $v['sort'] ?>">
                        <input name="id[]" type="hidden" value="<?php echo $v['id'] ?>">
                    </td>
                    <td>
                        <?php echo $v['id'] ?>
                    </td>
                    <td>
                        <img src="<?php echo $v['pic'] ?>" style="width:50%;margin-bottom: 8px">
                    </td> 
                    <td>
                        <?php echo $v['viewCount'] ?>
                    </td>
                    <td>
                        <?php echo $v['contentId'] ?>
                    </td>
                    <td>
                        <?php echo date('Y-m-d H:i:s', $v['createTime']) ?>
                    </td>

                    <td>
                        <a class="link-update"
                           href="<?php echo baseUrl . '/applets/banner/add' . '?' . 'id=' . $v['id'] ?>">修改</a>
                        <a class="link-del" href="" onclick="del(<?php echo $v['id'] ?>)">删除</a>
                    </td>
                </tr>
            <?php } ?>
        </table>
        <input type="hidden" name="cate" value="4">
        <button class="push btn btn-primary" type="submit">排序</button>
    </form>
</div>
<script>
    function del(id) {
        if (confirm("确定删除内容吗")) {
            $.get("/applets/banner/del", {id: id},
                function (msg) {
                    if (msg) {
                        alert('删除成功');
                   window.location.reload();
                    }
                }, 'text'
            );
        }
    }
</script>
